#ifndef __SPI_H__
#define __SPI_H__
#include<cfg/SysConfig.h>

void spi_init(void);

#define SPI_TX_BUF SPDR
#define SPI_RX_BUF SPDR


// other
#define SPI_WAIT()  { while ( !(SPSR & (1<<SPIF)) ); }
#define WAIT_EOTX() SPI_WAIT()
#define WAIT_EORX() SPI_WAIT()


uint8_t spi_write_single(uint8_t byte);
uint8_t spi_read_single(void);
uint8_t spi_write(uint8_t* data, int16_t len);
void spi_read(uint8_t* data, int16_t len);



#endif
